package com.tedu.webDemo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
	@RequestMapping("/loginByNP")
	@ResponseBody//方法返回字符串
	//如果类加的是@restController,不用加@responseBody
	public String loginByNameAndPwd
	(String username,String pwd) {
		return "loginByNameAndPwd";
	}
	
	@RequestMapping("/loginByC")
	//不加responsebody
	public String loginByCode(
			String username,
			String pwd,
			String code) {
		//验证码通过
		//调用loginByNameAndPwd()
		return "forward:/loginByNP";
	}
	//模拟有个以前的登录方法
	@RequestMapping("/login")
	public String login() {
		return "redirect:http://localhost:8080/list";
	}

}
